<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />
		<title>学习记录</title>
		<link rel="stylesheet" type="text/css" href="css/main.css" />
		<link rel="stylesheet" type="text/css" href="css/record.css" />
		<script src="js/rem.js" type="text/javascript" charset="utf-8"></script>
	</head>

	<body>
		<div class="top" id="top" v-cloak>
			<img src="img/18@3x.png" width="100%" height="100%" class="bottom " />
			<img src="img/12@2x.png" class="frame" />
			<div class="portrait">
				<img :src="users.head_img" />
			</div>
			<div class="information">
				<p>{{users.nick_name}}</p>
			</div>
		</div>
		<div class="main" id="main" v-cloak>
			<!--<div class="article" v-for="(item,index) in list" v-if="list[index].type === 2" v-on:click="Jump(list,index)">
				<div>
					<img :src="list[index].pic" />
				</div>
				<div>
					<span>{{list[index].title}}</span>
					<span  v-if="list[index].state === 0">未完成</span>
					<span  v-if="list[index].state === 1">已完成</span>
				</div>
			</div>-->
			<div class="article" v-for="(item,index) in list" v-on:click="Jump(list,index)">
				<div>
					<img :src="list[index].pic" />
				</div>
				<div>
					<span>{{list[index].title}}</span>
					<span v-if="list[index].type === '0'">{{list[index].time}}</span>
					<span v-if="list[index].type === '1'">{{list[index].time}}</span>
					<span v-if="list[index].type === '2'">{{list[index].time}}</span>
				</div>
			</div>
		</div>
		<script src="js/jquery-1.9.1.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/common.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/vue.min.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript ">
			getOpenId();
			//调用学习记录
			$.ajax({
				url: apiPath + 'index/study-history',
				type: 'post',
				dataType: 'json',
				data: {
					open_id: open_id,
					flagsign: 1
				},
				success: function(data) {
					console.log(data.returnData.user)
					var top = new Vue({
						el: '#top',
						data: {
							users: data.returnData.user
						},
					});
					var main = new Vue({
						el: '#main',
						data: {
							list: data.returnData.history
						},
					});

				}
			});

			function Jump(list, index) {
				var id = list[index].id,
					type = list[index].type;
				if(type == 0) {
					window.location.href = path + 'article.html?id=' + id
				};
				if(type == 1) {
					window.location.href =  path + "curriculum_video.html?id=" + id
				};
				if(type == 2) {
					window.location.href =  path + "test/test.html?id=" + id
				}
			}
		</script>
	</body>

</html>